import Vue from 'vue'
import VueRouter from 'vue-router'
import UserList from "@/views/UserList";
import RoleList from "@/views/RoleList";
import HelloWorld from "@/views/HelloWorld";
import Home from "@/views/Home";

Vue.use(VueRouter)

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
    routes: [
        {path: '/', redirect: '/home'},
        {path: '/home', name: 'Home', component: Home},
        {path: '/user-list', name: 'UserList', component: UserList},
        {path: '/user-list1', name: 'UserList1', component: UserList},
        {path: '/user-list2', name: 'UserList2', component: UserList},
        {path: '/user-list3', name: 'UserList3', component: UserList},
        {path: '/user-list4', name: 'UserList4', component: UserList},
        {path: '/user-list5', name: 'UserList5', component: UserList},
        {path: '/role-list', name: 'RoleList', component: RoleList},
        {path: '/hello-world', name: 'HelloWorld', component: HelloWorld},
    ]
})


export default router

